-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dgram buffers #13623
Dgram buffers #13623
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % Some nits
doc/api/dgram.md
Outdated
@@ -396,6 +396,26 @@ decremented to 0 by a router, it will not be forwarded. | |||
The argument passed to to `socket.setMulticastTTL()` is a number of hops | |||
between 0 and 255. The default on most systems is `1` but can vary. | |||
|
|||
### socket.setRecvBufferSize(size) | |||
<!-- YAML | |||
added: vx.x.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put REPLACEME
we have a macro that fills it it
doc/api/dgram.md
Outdated
|
||
### socket.setSendBufferSize(size) | ||
<!-- YAML | ||
added: vx.x.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
CI sais 🔴 339 parallel/test-dgram-set-socket-buffer-size
duration_ms 0.64
severity fail
stack
assert.js:569
throw actual;
^
Error: setRecvBufferSize EBADF
at exports._errnoException (util.js:1014:11)
at Socket.setRecvBufferSize (dgram.js:647:11)
at assert.throws (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-dgram-set-socket-buffer-size.js:12:12)
at _tryBlock (assert.js:526:5)
at _throws (assert.js:547:12)
at Function.throws (assert.js:577:3)
at Object.<anonymous> (/data/iojs/build/workspace/node-test-commit-linuxone/nodes/rhel72-s390x/test/parallel/test-dgram-set-socket-buffer-size.js:11:10)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32) |
...or even: (Right? It will always start with |
args.Holder(), | ||
args.GetReturnValue().Set(UV_EBADF)); | ||
|
||
CHECK(args[0]->IsUint32()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't want to crash when the user does socket.setRecvBufferSize(Infinity)
. Throwing a TypeError should be a better choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimothyGu you mean on the JS side, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted, do you recommend:
if (!args[0]->IsUint32()) {
return env->ThrowTypeError("size must be an uint32");
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend doing the type check in JS. Just something simple like:
const errors = require('internal/errors');
// then within the the functions
if (typeof size !== 'number')
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'size', 'number');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your input. Do you think I need to do any safety checking in udp_wrap.cc SetRecvBufferSize() or we assume only dgram.js will interact with udp_wrap ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, once the type checking is added to the js side, I would keep the CHECK in place on the native side. That should only be hit if we do something wrong in core or if the user is doing something they really shouldn't.
src/udp_wrap.cc
Outdated
|
||
CHECK(args[0]->IsUint32()); | ||
|
||
int inputSize = args[0]->Uint32Value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uint32Value
without v8::Context specified is deprecated. Use args[0]->Uint32Value(info.GetIsolate()->GetCurrentContext())
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we generally prefer camelCase for JavaScript and snake case for C++.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, will see to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
args[0]->Uint32Value(info.GetIsolate()->GetCurrentContext())
.
That’s not necessary if you already checked args[0]->IsUint32()
,args[0].As<Uint32>()->Value()
should do instead.
lib/dgram.js
Outdated
var err = this._handle.setRecvBufferSize(size); | ||
|
||
if (err) { | ||
throw errnoException(err, 'setRecvBufferSize'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer using internal/errors
here since this introduces new errors. The errno can be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DamienOReilly add the new error code at https://github.com/nodejs/node/blob/master/lib/internal/errors.js#L164 (you can put placeholders in the message like in https://github.com/nodejs/node/blob/master/lib/internal/errors.js#L121
lib/dgram.js
Outdated
|
||
|
||
Socket.prototype.setSendBufferSize = function(size) { | ||
var err = this._handle.setSendBufferSize(size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because _handle.setSendBufferSize()
includes a CHECK
that will abort if size
is not UInt32
, these should do a proper type check in the js side. Otherwise users will not be happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd prefer a check in JS that will throw an internal/errors.TypeError
this is a good check Number.isFinite(num) && num <= Number.MAX_SAFE_INTEGER && num >= 0;
Ref: https://github.com/nodejs/node/blob/master/lib/internal/process.js#L31
Ref: https://github.com/nodejs/node/blob/master/lib/internal/process.js#L62
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a good check
Number.isFinite(num) && num <= Number.MAX_SAFE_INTEGER && num >= 0;
It’s not an uint32 check, though. I think num >>> 0 === num
would work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, completely forgot about the existence of >>>
So much fun working with talented people 🕺
@@ -396,6 +396,26 @@ decremented to 0 by a router, it will not be forwarded. | |||
The argument passed to to `socket.setMulticastTTL()` is a number of hops | |||
between 0 and 255. The default on most systems is `1` but can vary. | |||
|
|||
### socket.setRecvBufferSize(size) | |||
<!-- YAML |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to also include these as options when the Socket
is created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is a good idea.
src/udp_wrap.cc
Outdated
|
||
CHECK(args[0]->IsUint32()); | ||
|
||
int inputSize = args[0]->Uint32Value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we generally prefer camelCase for JavaScript and snake case for C++.
lib/dgram.js
Outdated
Socket.prototype.setRecvBufferSize = function(size) { | ||
var err = this._handle.setRecvBufferSize(size); | ||
|
||
if (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style nit: Core prefers no curly braces on single line if
s.
doc/api/dgram.md
Outdated
@@ -454,10 +474,14 @@ s.bind(1234, () => { | |||
|
|||
### dgram.createSocket(options[, callback]) | |||
<!-- YAML | |||
added: v0.11.13 | |||
added: REPLACEME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't change the version this was added. Each function does support it's own changelog though. See the child_process.spawn()
docs for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thanks.
lib/dgram.js
Outdated
return Number.isFinite(size) && | ||
size <= Number.MAX_SAFE_INTEGER && | ||
size >= 0 && | ||
size >>> 0 === size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function seems like a bit of overkill for detecting an unsigned int.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the last condition implies all the others, so it is sufficient.
lib/dgram.js
Outdated
@@ -121,6 +122,12 @@ function Socket(type, listener) { | |||
|
|||
// If true - UV_UDP_REUSEADDR flag will be set | |||
this._reuseAddr = options && options.reuseAddr; | |||
|
|||
if (options && options.recvBufferSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're adding more options, it might be better to just make sure options
is an object. Adding these underscored properties also means we have to maintain them indefinitely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, we could use the libuv calls to with value === 0
to get the current value.
Also, it looks like these underscored properties aren't used in setRecvBufferSize()
and setSendBufferSize()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DamienOReilly tl;dr, if you don't need them later, no need to store them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are used in startListening()
which is called after the socket has been bound. They will in turn determine if setRecvBufferSize()
and setSendBufferSize()
are called if the specific options have been set against the Socket
created with dgram.createSocket()
. Otherwise setRecvBufferSize()
and setSendBufferSize()
can be called on the Socket
object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have to store these, I'd say use symbols. It's kind of ugly though because if the values are updated later, these values aren't kept in sync. And, libuv provides APIs to get those values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjihrig I guess extending this PR to add functionality to the interface in JS layer to use getsockopt
down in libuv might be a good idea (e.g. getRecvBufferSize()
). Therefore the symbol values holding initial options can be ignored after they are set against the socket when the listening
event triggers.
lib/dgram.js
Outdated
@@ -140,6 +147,12 @@ function startListening(socket) { | |||
socket._receiving = true; | |||
socket._bindState = BIND_STATE_BOUND; | |||
socket.fd = -42; // compatibility hack | |||
|
|||
if (socket._recvBufferSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason these if
s can't be combined with the other ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buffer sizes can only be set after the socket has been created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right, sorry. I was reading the diff as if the changes were in the same function. Might be a good case for #5496 though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Might look at that next!
type: Error, | ||
message: /^Coud not set buffer size: E[A-Z]+$/ | ||
})); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove these extra blank lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting close 👍
lib/dgram.js
Outdated
@@ -121,6 +122,12 @@ function Socket(type, listener) { | |||
|
|||
// If true - UV_UDP_REUSEADDR flag will be set | |||
this._reuseAddr = options && options.reuseAddr; | |||
|
|||
if (options && options.recvBufferSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DamienOReilly tl;dr, if you don't need them later, no need to store them.
lib/dgram.js
Outdated
var err = this._handle.setSendBufferSize(size); | ||
|
||
if (err) | ||
throw new errors.TypeError('ERR_SOCKET_SET_BUFFER_SIZE', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INHO this should be a regular error.Error
(same signature)
lib/dgram.js
Outdated
@@ -326,6 +350,11 @@ function enqueue(self, toEnqueue) { | |||
} | |||
|
|||
|
|||
function isValidSize(size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just inline this in the only place it's used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. It makes sense.
added: REPLACEME | ||
--> | ||
|
||
* Returns {number} the `SO_RCVBUF` socket receive buffer size in bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought, but we might not need to mention SO_RCVBUF
and SO_SNDBUF
at all. They aren't really needed to work with the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not needed, but I though it was no harm having them mentioned in the docs. I'd like to get a few people's opinion on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that googling SO_RCVBUF
gives very good results (linux man and MSDN) so I'm +0.5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can always add something like (see socket(7))
if you like, the doctool will expand that into a link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the record, I'm not opposed to including them. I just thought we might be able to get by without them. I'm open to whatever everyone thinks is best here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I know, the only reason I included them was that I was familiar with setting the buffer sizes with the JDK, and the javadocs mentioned these property names. When I started working on a small app to get more familiar with javascript, I was goggle'in around "node.js SO_RCVBUF" to see if anyone had already added or was in the process of adding buffer size setting support in node.js.
src/udp_wrap.cc
Outdated
CHECK(args[1]->IsUint32()); | ||
int size = (int)args[0].As<Uint32>()->Value(); | ||
|
||
int err = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't really need to initialize this to zero. It will always be set by one branch of the following if
statement.
src/udp_wrap.cc
Outdated
int err = 0; | ||
if (args[1].As<Uint32>()->Value() == 0) | ||
err = uv_recv_buffer_size(reinterpret_cast<uv_handle_t*>(&wrap->handle_), | ||
&size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you line up &size
with reinterpret_cast
.
src/udp_wrap.cc
Outdated
err = uv_recv_buffer_size(reinterpret_cast<uv_handle_t*>(&wrap->handle_), | ||
&size); | ||
else | ||
err = uv_send_buffer_size(reinterpret_cast<uv_handle_t*>(&wrap->handle_), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here about alignment.
src/udp_wrap.cc
Outdated
if (err != 0) { | ||
std::string syscall; | ||
if (args[1].As<Uint32>()->Value() == 0) | ||
syscall = "uv_recv_buffer_size"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe drop syscall
and just duplicate the env->ThrowUVException()
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe yes, I originally had it this way but the duplication itched at me!
|
||
// Ensure buffer sizes can be set | ||
{ | ||
const socket = dgram.createSocket({ type: 'udp4', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little surprised the linter doesn't complain about this. Can you move type
to the next line with two spaces indentation.
// Should throw error if the socket is never bound. | ||
const socket = dgram.createSocket('udp4'); | ||
|
||
assert.throws(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The duplication here could probably be reduced.
socket.setRecvBufferSize(-1); | ||
}, common.expectsError({ | ||
code: 'ERR_SOCKET_BAD_BUFFER_SIZE', | ||
type: Error, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a TypeError
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it should, I am throwing TypeError in dgram.js, however the test is passing. Regardless I will update the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.expectsError()
is subtly broken. It relies on instanceof
to check the error type. So a TypeError
is an instance of Error
, which is why this passed. The simplest fix might be to check error.constructor
inside of common.expectsError()
. But that will require updating a bunch of tests because we're now using custom errors all over the place.
cc: @nodejs/testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
common.expectsError() is subtly broken
Ref: #13682
const socket = dgram.createSocket('udp4'); | ||
|
||
socket.bind(common.mustCall(() => { | ||
assert.throws(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about duplication here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like 💯
added: REPLACEME | ||
--> | ||
|
||
* Returns {number} the `SO_RCVBUF` socket receive buffer size in bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that googling SO_RCVBUF
gives very good results (linux man and MSDN) so I'm +0.5
Hi all, are there any outstanding comments you need addressed in this PR? |
@cjihrig You currently have the blocking red X on this one... |
Two things:
|
Will break YAML parsing! Original Node error: ``` Jonathans-MBP:node jon$ node tools/doc/generate.js --format=json doc/api/dgram.md Input file = doc/api/dgram.md { Error at generateError (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:165:10) at throwError (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:171:9) at readBlockSequence (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:935:7) at composeNode (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:1331:12) at readBlockMapping (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:1062:11) at composeNode (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:1332:12) at readDocument (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:1492:3) at loadDocuments (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:1548:5) at load (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:1569:19) at Object.safeLoad (/Users/jon/code/nodejs/node/tools/eslint/node_modules/js-yaml/lib/js-yaml/loader.js:1591:10) name: 'YAMLException', reason: 'bad indentation of a sequence entry', mark: Mark { name: null, buffer: '\nadded: v0.11.13\nchanges:\n - version: REPLACEME\n pr-url: https://github.com/nodejs/node/pull/14560\n description: The `lookup` option is supported.\n - version: REPLACEME\n pr-url: https://github.com/nodejs/node/pull/13623\n description: `recvBufferSize` and `sendBufferSize` options are supported now.\n\u0000', position: 248, line: 8, column: 17 }, message: 'bad indentation of a sequence entry at line 9, column 18:\n description: `recvBufferSize` and `sendBuffer ... \n ^' } ``` Then I extracted out the problematic YAML, and tried running through Ruby as a separate `.yml` file: ``` Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 8 column 18 from /Users/jon/.rbenv/versions/2.4.0/lib/ruby/2.4.0/psych.rb:377:in `parse' from /Users/jon/.rbenv/versions/2.4.0/lib/ruby/2.4.0/psych.rb:377:in `parse_stream' from /Users/jon/.rbenv/versions/2.4.0/lib/ruby/2.4.0/psych.rb:325:in `parse' from /Users/jon/.rbenv/versions/2.4.0/lib/ruby/2.4.0/psych.rb:252:in `load' from (irb):7 from /Users/jon/.rbenv/versions/2.4.0/bin/irb:11:in `<main>' ```
this would need to be backported for v8.x |
This is not landing cleanly in v8.x because #14560 has not yet been backported. |
#15402 needs to be backported along with this. |
* setRecvBufferSize(int) and setSendBufferSize(int) * added docs for send/receive buffer sizes * Added options support to set buffer sizes in dgram.createSocket(). PR-URL: nodejs/node#13623 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit refactors the get/set send/receive buffer size methods in the following ways: - Use booleans instead of strings and numbers to differentiate between the send and receive buffers. - Reduce the amount of branching and complexity in the C++ code. Refs: nodejs#13623 PR-URL: nodejs#15483 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit refactors the get/set send/receive buffer size methods in the following ways: - Use booleans instead of strings and numbers to differentiate between the send and receive buffers. - Reduce the amount of branching and complexity in the C++ code. Refs: nodejs/node#13623 PR-URL: nodejs/node#15483 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* setRecvBufferSize(int) and setSendBufferSize(int) * added docs for send/receive buffer sizes * Added options support to set buffer sizes in dgram.createSocket(). PR-URL: #13623 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit refactors the get/set send/receive buffer size methods in the following ways: - Use booleans instead of strings and numbers to differentiate between the send and receive buffers. - Reduce the amount of branching and complexity in the C++ code. Refs: #13623 PR-URL: #15483 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* setRecvBufferSize(int) and setSendBufferSize(int) * added docs for send/receive buffer sizes * Added options support to set buffer sizes in dgram.createSocket(). PR-URL: #13623 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit refactors the get/set send/receive buffer size methods in the following ways: - Use booleans instead of strings and numbers to differentiate between the send and receive buffers. - Reduce the amount of branching and complexity in the C++ code. Refs: #13623 PR-URL: #15483 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* setRecvBufferSize(int) and setSendBufferSize(int) * added docs for send/receive buffer sizes * Added options support to set buffer sizes in dgram.createSocket(). PR-URL: #13623 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit refactors the get/set send/receive buffer size methods in the following ways: - Use booleans instead of strings and numbers to differentiate between the send and receive buffers. - Reduce the amount of branching and complexity in the C++ code. Refs: #13623 PR-URL: #15483 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* setRecvBufferSize(int) and setSendBufferSize(int) * added docs for send/receive buffer sizes * Added options support to set buffer sizes in dgram.createSocket(). PR-URL: #13623 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit refactors the get/set send/receive buffer size methods in the following ways: - Use booleans instead of strings and numbers to differentiate between the send and receive buffers. - Reduce the amount of branching and complexity in the C++ code. Refs: #13623 PR-URL: #15483 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
* setRecvBufferSize(int) and setSendBufferSize(int) * added docs for send/receive buffer sizes * Added options support to set buffer sizes in dgram.createSocket(). PR-URL: #13623 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit refactors the get/set send/receive buffer size methods in the following ways: - Use booleans instead of strings and numbers to differentiate between the send and receive buffers. - Reduce the amount of branching and complexity in the C++ code. Refs: #13623 PR-URL: #15483 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Notable Changes: * deps: * update npm to 5.4.2 #15600 * upgrade libuv to 1.15.0 #15745 * update V8 to 6.1.534.42 #15393 * dgram: * support for setting dgram socket buffer size #13623 * fs: * add support O_DSYNC file open constant #15451 * util: * deprecate obj.inspect for custom inspection #15631 * tools, build: * there is a fancy new macOS installer #15179 * Added new collaborator * bmeurer - Benedikt Meurer - https://github.com/bmeurer * kfarnung - Kyle Farnung - https://github.com/kfarnung PR-URL: #15762
Notable Changes: * deps: * update npm to 5.4.2 #15600 * upgrade libuv to 1.15.0 #15745 * update V8 to 6.1.534.42 #15393 * dgram: * support for setting dgram socket buffer size #13623 * fs: * add support O_DSYNC file open constant #15451 * util: * deprecate obj.inspect for custom inspection #15631 * tools, build: * there is a fancy new macOS installer #15179 * Added new collaborator * bmeurer - Benedikt Meurer - https://github.com/bmeurer * kfarnung - Kyle Farnung - https://github.com/kfarnung PR-URL: #15762
Notable Changes: * deps: * update npm to 5.4.2 nodejs/node#15600 * upgrade libuv to 1.15.0 nodejs/node#15745 * update V8 to 6.1.534.42 nodejs/node#15393 * dgram: * support for setting dgram socket buffer size nodejs/node#13623 * fs: * add support O_DSYNC file open constant nodejs/node#15451 * util: * deprecate obj.inspect for custom inspection nodejs/node#15631 * tools, build: * there is a fancy new macOS installer nodejs/node#15179 * Added new collaborator * bmeurer - Benedikt Meurer - https://github.com/bmeurer * kfarnung - Kyle Farnung - https://github.com/kfarnung PR-URL: nodejs/node#15762
Release team were -1 on landing on v6.x, if you disagree let us know. |
Add support to allow the dgram lib to set the SO_SNDBUF & SO_RCVBUF socket buffer sizes.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
doc, dgram